//
//  LSRevealSettingCell.m
//  LookScore
//
//  Created by wr on 2018/1/25.
//  Copyright © 2018年 ChongQingXunTiCompany. All rights reserved.
//

#import "LSRevealSettingCell.h"


#pragma mark 🔥 LSRevealLossPerCentCell

@interface LSRevealLossPerCentCell()

@property(strong,nonatomic)UIView *backView;

@end


@implementation LSRevealLossPerCentCell

+(LSRevealLossPerCentCell *)RevealLossPerCentCellByTableView:(UITableView *)tableView{
    
    LSRevealLossPerCentCell *cell=[tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self)];
    if (!cell) {
        cell=[[LSRevealLossPerCentCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(self)];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addContentView];
    }
    
    return self;
}

-(void)addContentView{
    
    UIView *lineView=[[UIView alloc]init];
    lineView.backgroundColor=LSBackGroundColor;
    [self.contentView addSubview:lineView];
    lineView.sd_layout.leftEqualToView(self.contentView).rightEqualToView(self.contentView).topEqualToView(self.contentView).heightIs(1);
    

    UIView *backView=[[UIView alloc]init];
    [self.contentView addSubview:backView];
    self.backView=backView;
    
    backView.sd_layout.topSpaceToView(lineView, 0).leftEqualToView(self.contentView).offset(20).rightEqualToView(self.contentView).offset(-20).bottomEqualToView(self.contentView);
    
    CGFloat width=(LSScreenWidth-40)/3;
    NSArray *titleArray=@[@"欧赔",@"亚盘",@"大小球"];
    UIButton *button;
    for (int i=0; i<3; i++) {
        button=[UIButton new];
        [button setTitle:titleArray[i] forState:UIControlStateNormal];
        [button setImage:[UIImage imageNamed:@"HomeUnChoose"] forState:UIControlStateNormal];
        [button setImage:[UIImage imageNamed:@"HomeChoose"] forState:UIControlStateSelected];
        [button setTitleColor:LSTitleGrayColor3 forState:UIControlStateNormal];
        [button setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0,-10)];
        button.titleLabel.font=[UIFont systemFontOfSize:13];
        button.tag=i;
        [button addTarget:self action:@selector(selecteDsecrecyEvent:) forControlEvents:UIControlEventTouchUpInside];
        [backView addSubview:button];
        if (i==0) {
            button.selected=YES;
           
        }
        button.sd_layout.leftEqualToView(backView).offset(width*i).centerYEqualToView(backView).widthIs(width).heightIs(25);
    }
    
}

#pragma mark 😄eventClick
-(void)selecteDsecrecyEvent:(UIButton *)sender{
    
    if (sender.selected==NO) {
        sender.selected=!sender.selected;
        if (sender.selected==YES ) {
            
            for (UIButton *button in self.backView.subviews) {
                if ([button isKindOfClass:[UIButton class]]) {
                    
                    if (sender.tag==button.tag) {
                        button.selected=YES;
                        switch (sender.tag) {
                            case 0:
                               
                                break;
                            case 1:
                              
                                break;
                            case 2:
                             
                                break;
                                
                            default:
                                break;
                        }
                    }else{
                        button.selected=NO;
                        
                    }
                }
            }
        }
    }
    
    
}


@end


#pragma mark 🔥 LSRevealSettingOptionsCell
@interface LSRevealSettingOptionsCell()




@end


@implementation LSRevealSettingOptionsCell

+(LSRevealSettingOptionsCell *)RevealSettingOptionsCellByTableView:(UITableView *)tableView{
    LSRevealSettingOptionsCell *cell=[tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self)];
    if (!cell) {
        cell=[[LSRevealSettingOptionsCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(self)];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addContentView];
    }
    
    return self;
}

-(void)addContentView{
   
    UIView *lineView=[[UIView alloc]init];
    lineView.backgroundColor=LSBackGroundColor;
    [self.contentView addSubview:lineView];
   lineView.sd_layout.leftEqualToView(self.contentView).rightEqualToView(self.contentView).topEqualToView(self.contentView).heightIs(1);
    
    UILabel *titleLab=[[UILabel alloc]init];
    titleLab.font=LSFontSize13;
    titleLab.textColor=LSTitleGrayColor3;
    [self.contentView addSubview:titleLab];
    self.titleLab=titleLab;
    titleLab.sd_layout.leftEqualToView(self.contentView).offset(20).centerYEqualToView(self.contentView).widthRatioToView(self.contentView,.6).heightRatioToView(self.contentView, .8);
    
    UISwitch *switchBu=[[UISwitch alloc]init];
    switchBu.on=NO;
    switchBu.onTintColor=LSSubColorFF9E44;
    switchBu.tintColor=Color(223, 225, 227);
    switchBu.thumbTintColor=  Color(223, 225, 227);
    switchBu.onImage=[CommonClass getImageWithBgColor:LSSubColorFF9E44];
    switchBu.offImage=[CommonClass getImageWithBgColor:[UIColor whiteColor]];
    [switchBu addTarget:self action:@selector(switchEvent:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:switchBu];

     switchBu.sd_layout.rightEqualToView(self.contentView).offset(-LSSpaceLeftWidth1).centerYEqualToView(self.contentView).heightIs(switchBu.height);
}


-(void)switchEvent:(UISwitch *)sender{
    
    NSInteger selectedInt=sender.selected?1:0;
    
    switch (selectedInt) {
        case 1:
             sender.thumbTintColor=  Color(223, 225, 227);
            break;
        case 0:
             sender.thumbTintColor= [UIColor whiteColor];
          
            break;
        default:
            break;
    }
    sender.selected=!sender.selected;
}
@end




#pragma mark 🔥 LSRevealSettingCell

@interface LSRevealSettingCell()


@end


@implementation LSRevealSettingCell

+(LSRevealSettingCell *)RevealSettingCellByTableView:(UITableView *)tableView{
    LSRevealSettingCell *cell=[tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self)];
    if (!cell) {
        cell=[[LSRevealSettingCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(self)];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addContentView];
    }
    return self;
}

-(void)addContentView{
    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end


